<?php
	if (!empty($users)) {?>
	<h3><?=__('users.index.title') ?> | <a href="users/add"><?=__('users.add.addNew') ?></a></h3>
	<?=$this->Element('paging', array('disableCounter' => true)) ?>
	<table>
		<tr>
			<th>#</th>
			<th><?=$this->Paginator->sort('username', __('users.username')) ?></th>
			<th><?=$this->Paginator->sort('first_name', __('users.firstName')) ?></th>
			<th><?=$this->Paginator->sort('last_name', __('users.lastName')) ?></th>
			<th><?=$this->Paginator->sort('dob', __('users.dob')) ?></th>
			<th><?=__('users.viewLink') ?></th>
			<th><?=__('users.editLink') ?></th>
		</tr>

		<?php
		$i = intval($this->Paginator->counter('{:start}'));
		foreach($users as $user) { ?>

		<tr>
			<td><?=$i++; ?> </td>
			<td><?=$user['User']['username']; ?></td>
			<td><?=$user['User']['first_name']; ?></td>
			<td><?=$user['User']['last_name']; ?></td>
			<td><?=!empty($user['User']['dob']) ? date('d-m-Y', strtotime($user['User']['dob'])) : '-' ?></td>
			<td><a href="users/view/<?=$user['User']['id']; ?>"><?=__('users.viewLink') ?></a></td>
			<td><a href="users/edit/<?=$user['User']['id']; ?>"><?=__('users.editLink') ?></a></td>
		</tr>
		<?php }?>
	</table>

	<?=$this->Element('paging') ?>

<?php } else {?>

	<p><?=__('users.index.noUser')?></p>
<?php }?>
